import { string } from "vue-types";

export class storeproduct {
  id?: number;
  storeInfo = ''
  "image" = 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'
  "sliderImages" = ['https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg']
  "videoLink" = ""
  "sliderImage" = ""
  "storeName" = ""
  "keyword" = ""
  "cateIds" = []
  "cateId": string = ''
  "unitName" = ""
  "sort" = 0
  "giveIntegral" = 0
  "ficti" = 0
  "isShow" = false
  "isBenefit" = false
  "isNew" = false
  "isGood" = false
  "isHot" = false
  "isBest" = false
  "tempId" = ""
  "attrValue": IattrValue[] = []
  attr: Iattr[] = []
  "selectRule" = ""
  "isSub" = false
  "content" = ""
  "specType" = false

  "couponIds": string[] = []
  coupons: Icoupons[] = []
  "activity" = ["默认",
    "秒杀",
    "砍价",
    "拼团"]
  constructor(data?: storeproduct) {
    data && this.setProps(data);
  }

  setProps(data: storeproduct) {
    (Object.keys(this) as Array<keyof Istoreproduct>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}

export type Istoreproduct = Omit<storeproduct, 'setProps'>

export class attrValue {
  "image" = ""
  "price" = 0
  "cost" = 0
  "otPrice" = 0
  "stock" = 0
  "barCode" = ""
  "weight" = 0
  "volume" = 0
  id?: number
  productId?: number
  attrValue?: string
  constructor(data?: attrValue) {
    data && this.setProps(data);
  }

  setProps(data: attrValue) {
    (Object.keys(this) as Array<keyof IattrValue>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}

export type IattrValue = Omit<attrValue, 'setProps'>



export class attr {
  attrValue?: string[] = []
  attrName = ''
  inputVisible?= false
  attrsVal?= ''
  attrValues?= ''
  id?: number | string = ''
  constructor(data?: attr) {
    data && this.setProps(data);
  }

  setProps(data: attr) {
    (Object.keys(this) as Array<keyof Iattr>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}

export type Iattr = Omit<attr, 'setProps'>


export class coupons {
  name = ''

  constructor(data?: coupons) {
    data && this.setProps(data);
  }

  setProps(data: coupons) {
    (Object.keys(this) as Array<keyof Icoupons>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}

export type Icoupons = Omit<coupons, 'setProps'>

export class defaultGood {
  image = 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'
  sliderImages = ['https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg']
  videoLink = ''
  sliderImage = ''
  storeName = ''
  storeInfo = ''
  keyword = ''
  cateIds = [] // 商品分类id
  cateId = null // 商品分类id传值
  unitName = ''
  sort = 0
  giveIntegral = 0
  ficti = 0
  isShow = false
  isBenefit = false
  isNew = false
  isGood = false
  isHot = false
  isBest = false
  tempId = ''
  attrValue = {}
  attr = []
  selectRule = ''
  isSub = false
  content = ''
  specType = false
  id = 0
  couponIds = []
  coupons = []
  activity = ['默认', '秒杀', '砍价', '拼团']
  brokerage?= ''
  brokerageTwo?= ''
  constructor(data?: defaultGood) {
    data && this.setProps(data);
  }

  setProps(data: defaultGood) {
    (Object.keys(this) as Array<keyof IdefaultGood>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}

export type IdefaultGood = Omit<defaultGood, 'setProps'>